<!DOCTYPE html>
<html class="x-admin-sm">
{include file="common/static" /}
    <body>
        <div class="layui-fluid">
            <div class="layui-row">
                <form class="layui-form">
                  <div class="layui-form-item">
                      <label for="username" class="layui-form-label">
                          <span class="x-red">*</span>物品名称
                      </label>
                      <div class="layui-input-inline">
                          <input type="text" id="goods_name" name="goods_name" required="" lay-verify="required"
                          autocomplete="off" class="layui-input">
                      </div>
                  </div>
                <div class="layui-form-item">
                    <label for="username" class="layui-form-label">
                        <span class="x-red">*</span>物品数量
                    </label>
                    <div class="layui-input-inline">
                        <input type="text" id="goods_num" name="goods_num" required="" lay-verify="required"
                               autocomplete="off" class="layui-input">
                    </div>
                </div>

                  <div class="layui-form-item">
                      <label for="L_repass" class="layui-form-label">
                      </label>
                      <button  class="layui-btn" type="button" onclick="adds()">
                          增加
                      </button>
                  </div>
              </form>
            </div>
        </div>

    </body>
<script>
    function adds(){
        $.ajax({
            type:"post",
            url: "{:url('home/lease/adds')}",
            data: {
                goods_name:$('#goods_name').val(),
                goods_num:$('#goods_num').val(),
            },
            success: function(data){
                console.log(data);
                toastr.error(data.msg);
                if(data.code == 100){
                    setTimeout(function () {
                        layer.closeAll();
                        parent.location.reload();
                    },1500);
                }
            }});
    }
</script>

</html>
